package com.rs.game.player.dialogues.impl;

import com.rs.game.player.dialogues.Dialogue;
import com.rs.utils.Utils;

public class Wizard extends Dialogue {
	
    private int npcId;

    @Override
    public void start() {
	npcId = (Integer) parameters[0];
	sendNPCDialogue(npcId, 9827, "Hello there Magician " + Utils.formatPlayerNameForDisplay(player.getDisplayName()) + ". How may I help you today?");
    }

    @Override
    public void run(int interfaceId, int componentId) {
	if (stage == -1) {
	    stage = 0;
	    sendOptionsDialogue(DEFAULT_OPTIONS_TITLE, "Could you change my spellbook?", "Nothing, nevermind.");
	} else if (stage == 0) {
	    if (componentId == OPTION_1) {
		stage = 1;
		sendPlayerDialogue(9827, "Could you change my spellbook?");
	    } else if (componentId == OPTION_2) {
		end();
	    }
	} else if (stage == 1) {
	    stage = 2;
	    sendNPCDialogue(npcId, 9827, "Of course I can. What type of spellbook do you desire?");
	} else if (stage == 2) {
	    stage = 3;
	    sendOptionsDialogue(DEFAULT_OPTIONS_TITLE, "Normal.", "Ancient", "Lunar");
	} else if (stage == 3) {
	    if (componentId == OPTION_1) {
			player.getCombatDefinitions().setSpellBook(0);
			sendDialogue("You are now using the Modern spellbook.");
	    } else if (componentId == OPTION_2) {
			player.getCombatDefinitions().setSpellBook(1);
			sendDialogue("You are now using the Ancient spellbook.");
	    } else if (componentId == OPTION_3) {
			player.getCombatDefinitions().setSpellBook(2);
			sendDialogue("You are now using the Lunar spellbook.");
		} else
			end();
	}
    }

    @Override
    public void finish() {

    }
}